#include <RelativePosition.h>
#include <cmath>

RelativePosition
Side(float th1, float th2,
	   float slack)
{
	if(th1 != th1 || th2 != th2)
	{
		return UnknownSide;
	}
	else
	{
		float sn = sin(th2-th1);
		if(sn > slack) return LeftSide;
		else if(sn < -slack) return RightSide;
		else 
		{
			float cs = cos(th2-th1);
			if(cs > 0)
			{
				return FrontSide;
			}
			else
			{
				return BackSide;
			}
		}
	}
}
